VC ++ obtains the system time and program running time (precise to seconds and milliseconds ).
1. Use the CTime class (get the current system time, accurate to seconds)CString str; // obtain the system time CTime tm; tm = CTime: GetCurrentTime (); //
precise timing in microseconds
Long Long l1,l2,l3;
Timeval TV1;
Take a Time
Gettimeofday (&tv,null);
L1 = tv.tv_sec*1000*1000 + tv.tv_usec;
Execute some code, such as algorithm 1 ...
Second time taken
Gettimeofday (&tv,null);
L2 = tv.tv_sec*1000*1
(Transferred from) http://www.vckbase.com/document/viewdoc? Id = 1301
Precise Timing based on Windows in VCYouzhiyu, Institute of optoelectronic technology, Chinese Emy of Sciences
Download Sample project
In the industrial production control
Precise Timing based on windows in VCYouzhiyu, Institute of optoelectronic technology, Chinese Emy of SciencesDownload Sample projectIn the industrial production control system, there are many operations that require timed completion, such as
The start date of my97datepicker is earlier than the end date. The formatting time is precise to the time, minute, and second. I. Requirement: End Time> Start time. The time segment that does not meet the requirement cannot be selected.For example,
The systems we typically use, whether Linux or Windows, are non-real-time systems. Non-real-time systems can obtain very accurate current time, even by reading some of the CPU's registers to get a CPU cycle count clock, it is estimated that in
Method 1: wm_timer message ing in VC can be used for simple time control. First, call the settimer () function to set the timer interval. For example, settimer (0,200, null) sets the interval of Ms. Then in the Application
Program Added the
In the industrial production control system, there are many operations that need to be done regularly, such as displaying the current time regularly, periodically refreshing the progress bar on the screen, and sending commands and transmitting data
How to use the Gettimeofday () function1. Function prototypes#include int gettimeofday (struct timeval *tv, struct timezone *tz);2. DescriptionGettimeofday () returns the current time with the TV structure, and the local time zone information is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.